{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}
<div class="ag_postwrap">
	<div class="ag_rightend">
		<h2 class="ag_headerbar"><span class="ag_middle">##Section subscriptions##</span></h2>
	</div>

	{if ($user.id > 0 )}
		{if $agora_config.o_auto_subscriptions}
		<div class="ag_outerwrap">
			<form id="profile3" method="post" action="{$self_url}">
				<fieldset class="ag_inform">
					<legend class="ag_color">##Options##</legend>
					<div class="ag_infldset">
						<label for="auto_subscriptions">
							<input type="checkbox" id="auto_subscriptions" name="form[auto_subscriptions]" value="1" {if $user.auto_subscriptions}checked="checked"{/if} /> ##Autosubscrip##
						</label>
					</div>
				</fieldset>
				<div class="ag_postbuttons">
					<span>
						<input class="ag_button ag_btn_submit" type="submit" name="update" value="##Submit##" title="##Submit##" accesskey="s" />
					</span>
				</div>
				<input type="hidden" name="action" value="save" />
			</form>
		</div>
		<br />
		{/if}

		{if $num_pages > 1 }
		<div class="ag_postlinksTop">
			<div class="ag_pagelink">
				{include file=agora:include/paginate.tpl}
			</div>
		</div>
		{/if}
		<div class="ag_tablewrap">
			<div class="ag_rightend">
				<h2 class="ag_headerbar"><span class="ag_middle">##Subscribed Topics##: ({$topic_count})</span></h2>
			</div>
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th class="ag_column">##Topics##</th>
						<th class="ag_spacer">##Author##</th>
						<th class="ag_spacer">##Replies##</th>
						<th class="ag_spacer" style="width:80px;">##Action##</th>
					</tr>
				</thead>
				<tbody>
					{foreach from=$topics item=topic}
					<tr>
						<td class="ag_column"><a href="{url task=topic id=$topic.id}">{$topic.subject|truncate:70:'...'}</a></td>
						<td class="ag_spacer">{$topic.poster}</td>
						<td class="ag_topic">{$topic.num_replies}</td>
						<td class="ag_spacer"><a href="{url task=topic action=unsubscribe id=$topic.id}">##Unsubscribe##</a></td>
					</tr>
					{foreachelse}
					<tr>
						<td colspan="4" class="ag_spacer ag_empty_forum">##No subscribed topics##</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
		</div>
		{if $num_pages > 1 }
		<div class="ag_postlinksBottom">
			<div class="ag_pagelink">
				{include file=agora:include/paginate.tpl}
			</div>
		</div>
		{/if}

		<div class="ag_forum_separator"></div>

		<div class="ag_tablewrap">
			<div class="ag_rightend">
				<h2 class="ag_headerbar"><span class="ag_middle">##Subscribed Forums##: ({$forum_count})</span></h2>
			</div>
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th class="ag_column">##Forum##</th>
						<th class="ag_topic">##Topics## / ##Posts##</th>
						<th class="ag_spacer" style="width:80px;">##Action##</th>
					</tr>
				</thead>
				<tbody>
					{foreach from=$forums item=forum}
					<tr>
						<td class="ag_column">
							<div class="ag_forumName">
								<a href="{url task=forum id=$forum.id}">
									{$forum.forum_name|truncate:70:'...'}
								</a>
							</div>
							{if $forum.forum_desc}
							<div class="ag_forumDesc">
								{$forum.forum_desc|truncate:100:'...'}
							</div>
							{/if}
						</td>
						<td class="ag_topic">
							<p class="ag_color"><strong>{$forum.num_topics}</strong> ##Topics##</p>
							<p><strong>{$forum.num_posts}</strong> ##Replies##</p>
						</td>
						<td class="ag_spacer">
							<a href="{url task=forum action=unsubscribe_forum id=$forum.id}">##Unsubscribe##</a>
						</td>
					</tr>
					{foreachelse}
					<tr>
						<td colspan="3" class="ag_spacer ag_empty_forum">##No subscribed forums##</td>
					</tr>
					{/foreach}
				</tbody>
			</table>
		</div>	
	{else}
	<div class="ag_hint">##Login to manage your Subscriptions##</div>
	{/if}
</div>